import box/{tools,apk,logger,condit,ui}
import.config package

if ! Has-File $TGBIN;then
  chmod +x $RPBIN
  ln -s $RPBIN $TGBIN
fi

setin=$(yq -rPoy .allow-external-apps ~/.termux/termux.properties 2>/dev/null)
: ${setin:=false}
None=null
if ! In-Value setin || In-Value setin == None;then
  get_choose "需要覆写 Termux 配置以申请安装应用，继续？" yes
  Choose=$?
  case $Choose in
    100)
      LOCAL_DIR=$(dirname ${BASH_SOURCE[0]})
      source $LOCAL_DIR/setting.sh -- --env allow-external-apps=true
      ;;
    10[12])
      Msg "取消并继续"
      ;;
  esac
fi

TTB_COMPLETE=$PREFIX/etc/profile.d/termux-toolbox-complete.sh
if ! Has-File $TTB_COMPLETE;then
  $TTB_NAME %eval% > $TTB_COMPLETE
fi
